package com.project.controller;


import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.project.entity.User;
import com.project.mapper.TUserMapper;
import com.project.service.ITUserService;
import com.project.vo.UserVo;
import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author zhangyang
 * @since 2021-10-06
 */
@RestController
@RequestMapping("/user")
public class TUserController {
    @Autowired
    private ITUserService userService;
    @Autowired
    private TUserMapper mapper;
    @GetMapping("/login")
    public UserVo login(String username, String pwd) {
        return userService.login(username, pwd);
    }

    @PostMapping("update")
    public void update(int userId,String pwd){
        UpdateWrapper<User> wrapper = new UpdateWrapper<>();
        wrapper.eq("pk_userId",userId);
        User user = new User();
        user.setPwd(pwd);
        mapper.update(user,wrapper);
    }
}
